﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using X.Web;

namespace X.WebSite.Admin.User
{
    public partial class List : AdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindGridView();
            }
        }

        void BindGridView()
        {
            gvUserList.DataSource = Bll.User.GetUserList();
            gvUserList.DataBind();
        }

        protected void gvUserList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int userId = int.Parse(gvUserList.DataKeys[e.RowIndex].Value.ToString());

            Bll.User.Delete(userId);

            BindGridView();
        }
    }
}